import sympy

x = sympy.Symbol('x')
a = -1
b = 1
f = x
abs_f = sympy.Abs(f)

integral_f = sympy.integrate(f, (x, a, b))
integral_abs_f = sympy.integrate(abs_f, (x, a, b))

print(f"∫_[{a},{b}] {f} dx = {integral_f}")
print(f"∫_[{a},{b}] |{f}| dx = {integral_abs_f}")
print(f"验证: |{integral_f}| ≤ {integral_abs_f} 为 {abs(integral_f) <= integral_abs_f}")